package core.dal;

import core.dto.VirtualWeight;

public class WeightFunctionality implements IFunctionality {

	VirtualWeight vW;

	public WeightFunctionality(VirtualWeight vW) {
		this.vW = vW;
	}

	public double calculateNetto(double brutto, double tara) {
		vW.setBrutto(brutto);
		vW.setTara(tara);
		double netto = vW.getBrutto() - vW.getTara();
		
		//Netto weight cannot be below 0
		if (netto < 0)
			return 0;
		else
			return vW.getBrutto() - vW.getTara();
	}

	public String getPassword() {
		return vW.getPassword();
	}
}
